<?php
    $query="SELECT * FROM Umowa";

    $wynik=mysql_query($query) or die('zapytanie niudane: '.mysql_error());

    echo "<form action=\"skrypty/klienci/akcje/modUsUmowa.php?login=$login\" method=\"post\">";
		echo "<table><tr>
				<td>Usuń</td>
                <td>Modyfikuj</td>
				<td>Id</td>
                <td>Klient</td>
                <td>Kwota</td>
                <td>Zaliczka</td>
                <td>Data Rozpoczecia</td>
                <td>Data Zakończenia</td>
                <td>Treść</td>
                <td>Pliki</td>
			</tr>";


        while($line = mysql_fetch_array($wynik, MYSQL_NUM)){
            $adres = "skrypty/klienci/form/podglUmowa.php?id={$line[0]}";
            $adres2 = "skrypty/klienci/form/plikiUmowa.php?id={$line[0]}";
			echo "<tr>";
                echo "<td><input type=checkbox name=\"{$line[0]}\"></td>\n";
                echo "<td><Input type=radio name=\"mod\" value=\"{$line[0]}\"></td>\n";
                echo "<td>{$line[0]}</td>";

                $query = "SELECT * FROM Klient WHERE idKlienta={$line[6]}";
                $tmp=mysql_query($query) or die('zapytanie niudane: '.mysql_error());
                $tmp = mysql_fetch_row($tmp);
                if($tmp[10])
                    echo "<td>{$tmp[10]}</td>";
                else
                    echo "<td>{$tmp[1]} {$tmp[2]}</td>";
                for($i=1;$i<5;$i++)
                    echo "<td>{$line[$i]}</td>";
                echo "<td><a target=\"_blank\" href=\"$adres\"
                        onclick=\"window.open('$adres', '_blank', 'resizable=no,width=800,height=600').focus(); return false\">treść</a></td>\n";
                echo "<td><a target=\"_blank\" href=\"$adres2\"
                           onclick=\"window.open('$adres2', '_blank', 'resizable=no,width=800,height=600').focus(); return false\">pliki</a></td>";
            echo "</tr>\n";
		}
		echo "</table>";
        echo "<input type=submit name=\"usun\" id=\"usun\" value=\"usuń\"> | ";
        echo "<input type=submit name=\"modyfikuj\" id=\"modyfikuj\" value=\"modyfikuj\">";
        echo "</form>";


?>
